//
//  ASHomeHeadView.m
//  AvatarShow
//
//  Created by xunruiIOS on 2021/4/27.
//

#import "ASHomeHeadView.h"

@implementation ASHomeHeadView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bannerView];
        [self addSubview:self.menuView];
        [self addSubview:self.lineView];
    }
    return self;
}


- (ASHomeBannerView *)bannerView{
    if (!_bannerView) {
        _bannerView = [[ASHomeBannerView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 85)];
    }
    return _bannerView;
}

- (ASHomeHeadMenuView *)menuView{
    if (!_menuView) {
        _menuView = [[ASHomeHeadMenuView alloc]initWithFrame:CGRectMake(0, self.bannerView.bottom, SCREEN_WIDTH + 5, 98)];
    }
    return _menuView;
}

- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, self.menuView.bottom, SCREEN_WIDTH, 5)];
        _lineView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    }
    return _lineView;
}

- (void)setDataArr:(NSArray *)dataArr{
    if (_dataArr.count < 2 || self.bannerView.dataSource.count < 2) {
        _dataArr = dataArr;
        self.bannerView.dataSource = dataArr;
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
